package strings

import "fmt"

func Parse(i interface{}) (result string) {
	if i == nil {
		return
	}

	type iString interface {
		String() string
	}

	switch value := i.(type) {
	case string:
		result = value
	case iString:
		result = value.String()
	case error:
		result = value.Error()
	case []byte:
		result = string(value)
	default:
		result = fmt.Sprint(value)
	}

	return
}
